﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmCalculoComisiones.aspx.cs" Inherits="pryCallCenter.Procesos.CalculoComisiones.frmCalculoComisiones" %>

<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxRoundPanel" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .periodo
        {
            width:275px;
        }
        .style2
        {
            width:200px;
        }
        .style3
        {
            margin-left: 36%;
            font-size: 16px;
        }
        .style4
        {
            float:left;
            width:69.5%;
            margin-right:1em;
            text-align:right;
        }
        .style5
        {
            text-align:right !important;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="100%"  HeaderText="Cálculo de Comisiones">
        <PanelCollection>
            <dx:PanelContent>
                 <div class="CssHeader">
                    <div align="center" class="CssTitle4" >
                                C&Aacute;LCULO DE COMISIONES
                    </div>
                    <div class="CssRigth">
                        <dx:ASPxPanel ID="ASPxPanel1" runat="server" Width="100%">
                            <PanelCollection>
                                <dx:PanelContent>
                                        <table class="style1">
                                        <tr>
                                            <td class="style1">Usuario:</td>  
                                            <td>
                                                <dx:ASPxTextBox ID="txtUsuario" runat="server" Width="170px">
                                                </dx:ASPxTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Fecha de Pedido:</td>    
                                            <td>
                                                <dx:ASPxDateEdit ID="dtpFecha" runat="server">
                                                </dx:ASPxDateEdit>
                                            </td>
                                        </tr>
                                    </table>
                                </dx:PanelContent>
                            </PanelCollection>
                        </dx:ASPxPanel>                    
                    </div>            
                 </div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div class="CssCuerpo">
                        <fieldset class="periodo">
                            <legend>Periodo de C&aacute;lculo</legend>
                            <table class="style1">
                                <tr>
                                    <td>
                                        Desde : 
                                    </td>                            
                                    <td>
                                        <dx:ASPxDateEdit ID="dtpDesde" runat="server">
                                        </dx:ASPxDateEdit>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Hasta : 
                                    </td>
                                    <td>
                                        <dx:ASPxDateEdit ID="dtpHasta" runat="server">
                                        </dx:ASPxDateEdit>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="right" style="padding-top:0.75em;">
                                        <dx:ASPxButton ID="btnCalcularComisiones" runat="server" 
                                            Text="Calcular Comisi&oacute;n" AutoPostBack="False" 
                                            OnClick="CalcularComision" style="margin-top: 0px">
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                        <div>
                    
                            <table class="style1">
                                <tr>
                                    <td colspan="2">
                                        <span class="style3">Resumen de Comisiones</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <dx:ASPxGridView ID="dgvResumenComisiones" runat="server" AutoGenerateColumns="False" Width="100%" KeyFieldName="nomempleado">
                                            <Columns>
                                                <dx:GridViewDataTextColumn Caption="CodEmpleado" FieldName="codempleado" ShowInCustomizationForm="True" Visible="False" VisibleIndex="0"></dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Nombre" FieldName="nomempleado" ShowInCustomizationForm="True" VisibleIndex="1"></dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Monto Comision" FieldName="montocomision" ShowInCustomizationForm="True" VisibleIndex="2"></dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Nro. Ventas" FieldName="nroventas" ShowInCustomizationForm="True" VisibleIndex="3"></dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Nro. Inasistencias" FieldName="nroinasist" ShowInCustomizationForm="True" VisibleIndex="4"></dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Dscto. Inasistencias" FieldName="dsctoasist" VisibleIndex="5"></dx:GridViewDataTextColumn>
                                            </Columns>
                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True"></SettingsBehavior>
                                        </dx:ASPxGridView>
                                    </td>
                                </tr>
                                <tr  style="height:55px;">
                                    <td align="right">
                                        <dx:ASPxButton ID="btnVerDetalleComision" runat="server" Text="Ver Detalle de Comisión" CssClass="style2" AutoPostBack="false" OnClick="VerDetalle"></dx:ASPxButton>
                                    </td>
                                    <td>
                                        <dx:ASPxButton ID="btnImprimir" runat="server" Text="Imprimir" AutoPostBack="false">
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        </div>
                        <div id="PopPup">
                            <dx:ASPxPopupControl  ID="pcDetalleComisiones" runat="server" ClientInstanceName="pcDetalleComisiones" HeaderText="Detalle de Comisiones Por Vendedor" 
                                    Width="500px" CloseAction="CloseButton" AllowDragging="True" EnableTheming="True" Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
                            <ContentCollection>
                                <dx:PopupControlContentControl>
                                <table>
                                    <tr>
                                        <td>
                                            <dx:ASPxGridView ID="dgvDetalleComisionesxOperador" runat="server" Width="500px" AutoGenerateColumns="False" KeyFieldName="documento">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn Caption="Documento" FieldName="documento" ShowInCustomizationForm="True" VisibleIndex="0"></dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="Fecha de Documento" FieldName="fhdocumento" ShowInCustomizationForm="True" VisibleIndex="1"></dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="Monto Comision" FieldName="montocomision" ShowInCustomizationForm="True" VisibleIndex="2"></dx:GridViewDataTextColumn>
                                                </Columns>
                                                <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                            </dx:ASPxGridView>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <dx:ASPxLabel ID="lblTotal" runat="server" Text="Total : " CssClass="style4"></dx:ASPxLabel>
                                            <dx:ASPxTextBox ID="txtTotal" runat="server" Width="140px" ReadOnly="true" CssClass="style5" HorizontalAlign="Right"></dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" >
                                            <div style="float:left;padding-left:10px; width:100%; margin:0 auto;" >
                                                <dx:ASPxButton ID="btnAceptar" runat="server" Text="Aceptar" Width="100px">
                                                    <ClientSideEvents Click="function(s, e) {pcDetalleComisiones.Hide();}" />
                                                </dx:ASPxButton>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                </dx:PopupControlContentControl>
                            </ContentCollection>
                            </dx:ASPxPopupControl>
                            <dx:ASPxPopupControl ID="pcMensaje" runat="server" ClientInstanceName="pcMensaje" HeaderText="Mensaje" Width="350px" CloseAction="CloseButton" AllowDragging="True" 
                                    EnableTheming="True" Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" AllowResize="True" DragElement="Window">
                                <HeaderStyle>
                                    <Paddings PaddingLeft="30px" />
                                    <BackgroundImage HorizontalPosition="10px" ImageUrl="~/img/iconError.png" Repeat="NoRepeat" />
                                </HeaderStyle>
                                <ContentCollection>
                                    <dx:PopupControlContentControl>
                                        <table class="style1">
                                            <tr>
                                                <td align="center">
                                                    <dx:ASPxLabel ID="lblMensaje" runat="server"></dx:ASPxLabel>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="center">                                                
                                                    <div style="padding:15px 0 0 0;" >
                                                        <dx:ASPxButton ID="btnPopUpAceptar" runat="server" Text="Aceptar" Width="100px"  AutoPostBack="False">
                                                                <ClientSideEvents Click="function(s, e) {pcMensaje.Hide();}" />
                                                        </dx:ASPxButton>
                                                    </div>                                                        
                                                </td>
                                            </tr>
                                        </table>
                                    </dx:PopupControlContentControl>
                                </ContentCollection>
                            </dx:ASPxPopupControl>          
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
